﻿using FastUtil.Data;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Text;

namespace FastEventBus.Entity
{
    public class FastEventParam
    {
        public string EventID { set; get; }
        public string ChannelName { set; get; }
        public DateTime EventDate { set; get; }
        [JsonExtensionData]
        private Dictionary<string, object> EventParamDic { set; get; }

        public FastEventParam()
        {
            EventID = GenerateUtil.GenerateRowGuid();
            EventDate = DateTime.Now;
            EventParamDic = new Dictionary<string, object>();
        }

        public void AddParam(string ParamName,object ParamValue)
        {
            if (EventParamDic.ContainsKey(ParamName))
            {
                EventParamDic[ParamName] = ParamValue;
            }
            else
            {
                EventParamDic.Add(ParamName, ParamValue);
            }
        }

        public object GetParam(string ParamName)
        {
            return EventParamDic[ParamName];
        }
    }
}
